const mongoose = require('mongoose')
const moment = require('moment')

// 搭建表结构
const userSchema = mongoose.Schema({
    username: {
        type: String,
        required: true
    },
    pwd: {
        type: String,
        required: true
    },
    profile: {
        type: String,
        required: true
    },
    create_time: {
        type: String,
        default: () => moment().format('YYYY-MM-DD hh:mm:ss')
    }
}, {
    versionKey: false
})

// 暴露UserModel表
module.exports = mongoose.model('users', userSchema)